Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filter: fix errors found by fuzz #1067

Merged
merged 1 commit into from
Jun 14, 2024
Merged

Conversation

manunio
Copy link
Contributor

@manunio manunio commented Jun 13, 2024

While fuzzing built-in filters center and indent, they errored out or caused an OOM due to a large value as input.

For center:

Executing task: cargo test --package askama --lib -- filters::tests::test_center --exact --show-output 

   Compiling askama v0.13.0 (/home/maxx/dev/security/oss-fuzz-projects/askama-manunio/askama)
    Finished `test` profile [unoptimized + debuginfo] target(s) in 0.93s
     Running unittests src/lib.rs (target/debug/deps/askama-0c856712117dc4ab)

running 1 test
memory allocation of 111669149696 bytes failed
error: test failed, to rerun pass `-p askama --lib`

For indent:

cargo +nightly fuzz run fuzz_filters artifacts/fuzz_filters/oom-72ee499821247cdd28e7e114c397347901d4d5c7
   Compiling askama v0.13.0 (/home/maxx/dev/security/oss-fuzz-projects/askama-manunio/askama)
   Compiling askama-fuzz v0.0.0 (/home/maxx/dev/security/oss-fuzz-projects/askama-manunio/fuzz)
    Finished `release` profile [optimized + debuginfo] target(s) in 3.25s
    Finished `release` profile [optimized + debuginfo] target(s) in 0.05s
     Running `target/x86_64-unknown-linux-gnu/release/fuzz_filters -artifact_prefix=/home/maxx/dev/security/oss-fuzz-projects/askama-manunio/fuzz/artifacts/fuzz_filters/ artifacts/fuzz_filters/oom-72ee499821247cdd28e7e114c397347901d4d5c7`
INFO: Running with entropic power schedule (0xFF, 100).
INFO: Seed: 3494758370
INFO: Loaded 1 modules   (12661 inline 8-bit counters): 12661 [0x560504272ec0, 0x560504276035), 
INFO: Loaded 1 PC tables (12661 PCs): 12661 [0x560504276038,0x5605042a7788), 
target/x86_64-unknown-linux-gnu/release/fuzz_filters: Running 1 inputs 1 time(s) each.
Running: artifacts/fuzz_filters/oom-72ee499821247cdd28e7e114c397347901d4d5c7
8
==399595== ERROR: libFuzzer: out-of-memory (malloc(2147483648))
   To change the out-of-memory limit use -rss_limit_mb=<N>

@manunio manunio force-pushed the fuzz-fix-oom-errors branch from e622cf4 to 2180649 Compare June 13, 2024 22:31
Copy link
Collaborator

@djc djc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

askama/src/filters/mod.rs Outdated Show resolved Hide resolved
askama/src/filters/mod.rs Outdated Show resolved Hide resolved
askama/src/filters/mod.rs Outdated Show resolved Hide resolved
While fuzzing built-in filters `center` and `indent`, they
errored out or caused an OOM due to a large value as input.
@manunio manunio force-pushed the fuzz-fix-oom-errors branch from 2180649 to b068ec5 Compare June 14, 2024 13:59
@djc djc merged commit 4e829ef into rinja-rs:main Jun 14, 2024
16 checks passed
@manunio manunio deleted the fuzz-fix-oom-errors branch June 14, 2024 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants